package com.bahiaapk.services;

import com.bahiaapk.util.BahiaUtil;

import android.app.Service; 
import android.content.Intent; 
import android.media.MediaPlayer; 
import android.net.Uri;
import android.os.IBinder; 
import android.util.Log; 
import android.widget.Toast; 

public class SynchronizeAudio extends Service { 

	MediaPlayer player; 

	@Override 
	public IBinder onBind(Intent intent) { 
		return null; 
	} 

	@Override 
	public void onCreate() { 
		Log.d(BahiaUtil.TAG, "SynchronizeAudio onCreate"); 
	
		player = MediaPlayer.create(this, Uri.parse("http://www.bahiaidc.com/arquivos/podcasts/466/ARQUIVO_PODCAST.MP3"));
		player.start();
		player.setLooping(false); // Set looping 
	} 

	@Override 
	public void onDestroy() { 
		Log.d(BahiaUtil.TAG, "SynchronizeAudio onDestroy"); 

		player.stop(); 
	} 
	
	@Override 
	public void onStart(Intent intent, int startid) { 
		Log.d(BahiaUtil.TAG, "SynchronizeAudio onStart"); 
		player.start(); 
	} 
} 